package com.jiangruanjavaproject;

import com.jiangruanjavaproject.address.BitCoinAddress;
import com.jiangruanjavaproject.bean.HotVideo;
import com.jiangruanjavaproject.bean.HotVideoCommon;
import com.jiangruanjavaproject.request.HttpUtils;
import com.jiangruanjavaproject.service.FontService;
import com.jiangruanjavaproject.service.GetBestBlockHashService;
import com.jiangruanjavaproject.service.Getblockchaininfo;
import com.jiangruanjavaproject.service.HotVideoService;

import java.awt.*;
import java.util.ArrayList;
import java.util.Scanner;

import static java.awt.SystemColor.menu;

public class Main {
    public static void main(String[] args) {
        new Main().run();
//        System.out.println("hello world");
        /*String url = Constants.CAR_URL
                +"?key=" + Constants.CAR_KEY
                +"&type=hot_video"
                +"&size=20";
        String result = HttpUtils.get(url);*
        System.out.println(result);*/
//        HotVideoCommon videoCommon = JSONObject.parseObject(result, HotVideoCommon.class)
//    System.out.println(videoCommon.reason);
//        System.out.println(videoCommon.error_code);

//        System.out.println(videoCommon.result.size());

    }
    public void run(){
        System.out.println("JAVA期末考查大作业系统");
        System.out.println("该系统已实现如下功能");
        System.out.println("1.聚合函数 2.比特币客户端 3.地址生成 4.地址校验 5.简繁转换");

        while (true){
            menu();
        }

    }
    public void menu(){
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        String  bit = null;

        switch (num){
            case 1:
                HotVideoService hotVideoService = new HotVideoService();
                hotVideoService.getHotVodeo();
                break;
            case 2:
                    sum();
                break;
            case 3:
                BitCoinAddress address = new BitCoinAddress();
                bit = address.newAddress();
                System.out.println("生成地址"+bit);


                break;
            case 4:
                BitCoinAddress bitcoin = new BitCoinAddress();
                Scanner scanner1 = new Scanner(System.in);
                System.out.println("输入地址"+scanner);
                String one = scanner.next();
                boolean result = bitcoin.validataAddress(one);
                System.out.println(result);
                break;
            case 5:
                FontService fontService = new FontService();
                fontService.getFontService();
                break;
            default:
                System.out.println("暂不支持,请重新输入");
        }
    }

    public void sum(){
        System.out.println("1.getbestblockhash 2.getblockchaininfo");
        Scanner scanner = new Scanner(System.in);
        int scan = scanner.nextInt();
        switch (scan){
            case 1:
                GetBestBlockHashService getBestBlockHashService = new GetBestBlockHashService();
                String re = getBestBlockHashService.getBestBlockHash();
                System.out.println(re);
            break;
            case 2:
                Getblockchaininfo getblockchaininfo = new Getblockchaininfo();
                String getblockchaininfo1 = getblockchaininfo.getblockchaininfo();
                System.out.println(getblockchaininfo1);
            break;
            default:
                System.out.println("暂无改选项");
        }
    }
}
